var host = process.env.HOST;

export default function(obj) {
	return new Promise((resolve, reject) => {
		let a = uni.uploadFile({
			url: host+'/admin/Index/upload', // 仅为示例，非真实的接口地址
			filePath: obj.url,
			name: 'file',
			formData: {
				user: 'test'
			},
			success: (res) => {
				
				var data = JSON.parse(res.data);
				
				if (data.code == 200) {
					resolve(data.data)
				} else {
					uni.showToast({icon:"none",title: data.msg});
					/*Message.error({
						background: true,
						content: data.msg
					})*/
					resolve();
				}
				
			}
		});
	})
}
